<template>
    <!-- // SEQ_NRSA视频指标_小区(天) -->
    <index-card :indexCardTitle="indexCardTitle">
        <el-table :data="tableData" v-loading="loading">
            <el-table-column prop="startTime" label="开始时间" min-width="200">
                <template #default="scope">
                    {{ scope.row.startTime ? formatDateNormal(scope.row.startTime) : null }}
                </template>
            </el-table-column>
            <el-table-column prop="cityName" label="地市名称" min-width="200" />
            <el-table-column prop="cgi" label="小区CGI" min-width="200" />
            <el-table-column prop="type" label="类别" min-width="200" />
            <el-table-column prop="streamNumberTotal" label="视频总单据" min-width="200" />
            <el-table-column prop="dwRttTimeU" label="视频高时延单据数" min-width="200" />
            <el-table-column prop="dwRttTimeURate" label="质差单据占比(%)" min-width="200" />
            <el-table-column prop="dwRttTimeU100" label="下行RTT时延大于100ms的单据数" min-width="200" />
            <el-table-column prop="dwRttTimeU150" label="下行RTT时延大于150ms的单据数" min-width="200" />
            <el-table-column prop="dwRttTimeU200" label="下行RTT时延大于200ms的单据数" min-width="200" />
            <el-table-column prop="streamThroughputTotal" label="视频总流量GB" min-width="200" />
            <el-table-column prop="downloadNumberTotal" label="有效下载数据量总和(GB)" min-width="200" />
            <el-table-column prop="transferTimeTotal" label="有效传输时长总和(ms)" min-width="200" />
            <el-table-column prop="streamDlKbps" label="视频下载速率Kbps" min-width="200" />
            <el-table-column prop="codeRateTotal" label="码率总和Kbps" min-width="200" />
            <el-table-column prop="codeRateDen" label="码率分母" min-width="200" />
            <el-table-column prop="avgCodeRate" label="平均码率Kbps" min-width="200" />
            <el-table-column prop="rateCodeRate" label="速率码率比" min-width="200" />
            <el-table-column prop="dwRttTimeNum" label="下行rtt时延ms分子" min-width="200" />
            <el-table-column prop="dwRttTimeDen" label="下行rtt时延ms分母" min-width="200" />
            <el-table-column prop="dwRttTime" label="下行rtt时延ms" min-width="200" />
            <el-table-column prop="ulRttTimeNum" label="上行RTTms分子" min-width="200" />
            <el-table-column prop="ulRttTimeDen" label="上行RTTms分母" min-width="200" />
            <el-table-column prop="ulRttTime" label="上行RTTms" min-width="200" />
            <el-table-column prop="cityId" label="地市编号" min-width="200" />
        </el-table>
    </index-card>
</template>

<script setup>
import { ref } from "vue";
import { apiCommon, formatDateNormal } from "@/utils/index.js";
import * as qualityApi from "@/api/biz/networkQuality";
import mittBus from "@/utils/mittBus"; // mitt事件总线

mittBus.on("get5GIndexItemData", (params) => {
    getData(params)
});

const props = defineProps({
    indexCardTitle: {
        type: String,
        default: '',
    },
    rowsData: {
        type: Object,
        default: () => { },
    },
});

const tableData = ref([]);
let loading = ref(false);

const getData = async (params) => {
    // console.log('params', params)

    loading.value = true;
    tableData.value = await apiCommon(qualityApi.getVideo5gResolutionList, params);
    tableData.value = tableData.value.data;
    loading.value = false;
}

getData(props.rowsData);
</script>